﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Core.DataAccess.Model.Project.Entrepot;
using Core.Framework.Util;
using Core.IBusiness.IEntrepotModule;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Core.Web.Controllers.Entrepot
{

    /// <summary>
    /// 产品采购
    /// </summary>
    [Route(".v1/Entrepot/[controller]")]
    [ApiController]
    [ApiVerification(IBusiness.IProjectModule.Model.APIServiceEnum.Shop)]
    public class ProductPurchaseController : BaseApiController
    {
        public ProductPurchaseController(IEntrepot iEntrepot) :
            base(iEntrepot: iEntrepot)
        { }

        /// <summary>
        /// 产品采购
        /// </summary>
        /// <param name="purchases"></param>
        /// <returns></returns>
        [HttpPost]
        public IResult POST(List<ProductPurchase> purchases)
        {
            return this.ExecMethod(
                () => {
                    return this.Result(this.iEntrepot.ProductPurchase(purchases));
                }, purchases.IsValid(IsValidEnum.reg));
        }

    }
}